<%@page import="entities.Staff"%>
<%@page import="java.util.TreeMap"%>
<%@page import="helpers.UrlHelper"%>

<%
TreeMap check = (TreeMap) request.getAttribute("check");
Staff user = (Staff) request.getAttribute("user");
String form = (String) request.getAttribute("form");
%>

<jsp:include page="/admin/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>

<script type="text/javascript" src="/admin/js/form_staff.js"></script>
		
		<div class="maincontent noright">
        	<div class="maincontentinner">
                <ul class="maintabmenu multipletabmenu">
                	<li><a href="/admin/staff/list">List User</a></li>
                	<li class="current"><a href="/admin/staff/add"><%=form.equalsIgnoreCase("edit") ? "Edit User" : "Add User" %></a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
					<jsp:include page="/admin/elements/message_box.jsp">
		            	<jsp:param name="language" value="1" />
					</jsp:include>
                    <div class="contenttitle">
                    	<h2 class="form"><span><%=form.equalsIgnoreCase("edit") ? "Edit User" : "Add User" %></span></h2>
                    </div><!--contenttitle-->
            
                    <form method="post" action="#" class="stdform stdform2" id="edit_user_form">
                    	
                        <p>
                        	<label>Username</label>
                            <span class="field">
                            	<input type="text" class="smallinput" name="username" id="u_username" value="<%=user.getUsername() != null ? user.getUsername() : "" %>" <%=form.equalsIgnoreCase("edit") ? "readonly=\"readonly\"" : "" %> >
                            	<% if (check.get("username") != null) { %>
									<label for="u_username" generated="true" class="error"><%=check.get("username") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Full name</label>
                            <span class="field">
                            	<input id="u_name" class="mediuminput" type="text" name="name" value="<%=user.getName() != null ? user.getName() : "" %>" maxlength="100">
                            	 <% if (check.get("name") != null) { %>
									<label for="u_name" generated="true" class="error"><%=check.get("name") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Status</label>
                            <span class="field">
                            	<select id="u_status" name="status" class="smallinput">
									<option value="0" <%=user.getStatus() == 0 ? "selected=\"selected\"" : "" %>>Inactive</option>
									<option value="1" <%=user.getStatus() == 1 ? "selected=\"selected\"" : "" %>>Pending</option>
									<option value="2" <%=user.getStatus() == 2 ? "selected=\"selected\"" : "" %>>Active</option>
								</select>
								<% if (check.get("status") != null) { %>
									<label for="u_status" generated="true" class="error"><%=check.get("status") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Role Access</label>
                            <span class="field">
                            	<select id="u_role" name="role" class="smallinput">
									<option value="0" <%=user.getRole() == 0 ? "selected=\"selected\"" : ""%>>User</option>
									<option value="1" <%=user.getRole() == 1 ? "selected=\"selected\"" : ""%>>Admin</option>
								</select>
								<% if (check.get("role") != null) { %>
									<label for="u_role" generated="true" class="error"><%=check.get("role") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p class="stdformbutton">
                        	<button class="submit radius2">Submit Button</button>
                            <input type="reset" value="Reset Button" class="reset radius2">
                        </p>
                        
                    </form>
                    
                    <br clear="all">
                    
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp">
            	<jsp:param name="language" value="1" />
			</jsp:include>
            
        </div>

<jsp:include page="/admin/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>